package com.zkadmin.repository;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.zkadmin.entity.SysResource;

public interface SysResourceRepository extends PagingAndSortingRepository<SysResource, Long>, QueryDslPredicateExecutor<SysResource> {

	public SysResource findByName(String name);

	public SysResource findByCode(String code);
	
	public SysResource findByPermission(String permission);

	public List<SysResource> findByCodeLike(String code);

	@Query("select r from SysResource r group by r.code")
	public Page<SysResource> findGrouped(Pageable pageable);

}
